package com.atguigu.atomic;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @Author 孔德成
 * @Slogan 致敬大师，致敬未来的你
 * @date 2021/8/9
 */
public class CASDemo {
    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger(5);
        System.out.println(atomicInteger.compareAndSet(5, 10) + "\t" + atomicInteger.get());
        System.out.println(atomicInteger.compareAndSet(5, 20) + "\t" + atomicInteger.get());
    }
}
